from selenium.webdriver.common.by import By
from 测试.common.Utils import Driver
class Person:
    url = ""
    driver = ""

    def __init__(self):
        self.driver = Driver.driver
        self.url = "http://127.0.0.1:9580/sign-in.html"
    def Test(self):
        # 点击头像
        #我的帖子
        self.driver.implicitly_wait(3)
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR, "#index_user_profile").click()
        text=self.driver.find_element(By.CSS_SELECTOR, "#bit-forum-content > div.page-body > div > div > div.col-lg-4 > div > div > div > div > h2").text
        actual="个人介绍"
        assert actual==text
        #个人中心
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR, " #index_user_settings").click()
        #修改昵称
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_nickname").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_nickname").send_keys("lian")
        self.driver.find_element(By.CSS_SELECTOR, " #setting_submit_nickname").click()
        name="lian"
        assert name!=self.driver.find_element(By.CSS_SELECTOR, "#setting_input_nickname").text



        #退出
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR, "#index_user_logout").click()
        text=self.driver.find_element(By.CSS_SELECTOR, "body > div > div > div > div:nth-child(1) > div > div.card.card-md > div > h2").text
        assert text=="用户登录"